import {
  getSign,
} from '@/services/aliyun/AliyunOss';

export default {
  namespace: 'AliyunOss',

  state: {
    aliyunOssSign: null,
  },

  effects: {
    * getSign({payload}, {call, put}) {
      const response = yield call(getSign, payload);
      if (response.code === 0) {
        yield put({
          type: 'chgAliyunOssSign',
          payload: response.data,
        });
      }
    },

  },

  reducers: {
    chgAliyunOssSign(state, action) {
      return {
        ...state,
        aliyunOssSign: action.payload,
      };
    },

  },

};
